package com.sysofstudent.dao;

import com.sysofstudent.po.Score;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ScoreRepository extends JpaRepository<Score,Long> {

//    @Query(nativeQuery = true,value = "SELECT * FROM t_score WHERE id IN (SELECT max(id) FROM t_score GROUP BY course)")
//    List<Score> getCourse();
//    @Query(nativeQuery = true,value = "DELETE FROM t_score WHERE course= :course")
//    void  deleteCourse(@Param("course") String course);
//
//    @Query(nativeQuery = true,value = "SELECT * FROM t_score WHERE course_id=:course_id")
//    List<Score> findScoreByCourse_id(@Param("course_id") long course_id);

    @Query(nativeQuery = true,value = "SELECT * FROM t_score WHERE course_id=:course_id")
    List<Score> findScoreByCourse_id(@Param("course_id")long course_id);


//    void edit(Score score);

    List<Score> findByCourse(long course_id);

    Score findScoreById(long id);
    void deleteAllByCourse(long course_id);
    List<Score> findAllByNumber(String number);
//    List<Score> findAllBy

}
